﻿using System;
using System.Collections.Generic;
using Model.Query_Model;
using Presenters.Inherited_Presenters;
using Interfaces.Update_Interfaces;
using Presenters.Managers;

namespace Presenters.Update_Presenters
{
    public class ValuationUpdatePresenter:OperationStatus
    {
        private IValuationUpdateView view = null;
        public RoadOutput road = null;

        public ValuationUpdatePresenter(IValuationUpdateView view)
        {
            this.view = view;
        }

        public void SendDataToView()
        {
            view.value = road.valuation.value;
            view.currency = road.valuation.currency;
        }

        public void Update()
        {
            nameOperation = "Aktualizacja ceny";
            try
            {
                RoadManager manager = new RoadManager();
                manager.RoadUpdate(road);
                view.ShowSuccess();
            }
            catch (Exception ex)
            {
                exception = ex.Message;
                view.ShowError();
            }
        }
    }
}
